#pragma once

#include "console_screen_frame_base.h"
#include "console_screen_set.h"
#include <iostream>

namespace my
{
	class console_screen_frame_wchar_t : public console_screen_frame_base<wchar_t>
	{
	public:

		console_screen_frame_wchar_t(int x, int y, int high, int wide,
			wchar_t up = 0, wchar_t down = 0,
			wchar_t left = 0, wchar_t right = 0,
			wchar_t top_left = 0, wchar_t bottom_left = 0,
			wchar_t top_right = 0, wchar_t bottom_right = 0)
			:console_screen_frame_base(x, y, high, wide, up, down, left, right,
				top_left, bottom_left, top_right, bottom_right)
		{
			;
		}

		void show()
		{
			printFrame();
		}

		void clean()
		{
			cleanFrame();
		}

	protected:

		void printCharUp()
		{
			SetPos(_x + 2, _y);
			for (int wide = 2; wide <= _wide - 4; wide += 2)
			{
				std::wcout << _up;
			}
		}

		void printCharDown()
		{
			SetPos(_x + 2, _y + _high - 1);
			for (int wide = 2; wide <= _wide - 4; wide += 2)
			{
				std::wcout << _down;
			}
		}

		void printCharLeft()
		{
			for (int high = 1; high <= _high - 2; ++high)
			{
				SetPos(_x, _y + high);

				std::wcout << _left;
			}
		}

		void printCharRight()
		{
			for (int high = 1; high <= _high - 2; ++high)
			{
				SetPos(_x + _wide - 2, _y + high);

				std::wcout << _right;
			}
		}

		void printCharCorner()
		{
			SetPos(_x, _y);
			std::wcout << _top_left;

			SetPos(_x + _wide - 2, _y);
			std::wcout << _top_right;

			SetPos(_x, _y + _high - 1);
			std::wcout << _bottom_left;

			SetPos(_x + _wide - 2, _y + _high - 1);
			std::wcout << _bottom_right;
		}

		void cleanCharUp()
		{
			SetPos(_x + 2, _y);
			for (int wide = 0; wide <= _wide - 4; ++wide)
			{
				std::cout << ' ';
			}
		}

		void cleanCharDown()
		{
			SetPos(_x + 2, _y + _high - 1);
			for (int wide = 0; wide <= _wide - 4; ++wide)
			{
				std::cout << ' ';
			}
		}

		void cleanCharLeft()
		{
			for (int high = 1; high <= _high - 2; ++high)
			{
				SetPos(_x, _y + high);

				std::cout << ' ' << ' ';
			}
		}

		void cleanCharRight()
		{
			for (int high = 1; high <= _high - 2; ++high)
			{
				SetPos(_x + _wide - 2, _y + high);

				std::cout << ' ' << ' ';
			}
		}

		void cleanCharCorner()
		{
			SetPos(_x, _y);
			std::cout << ' ' << ' ';

			SetPos(_x + _wide - 2, _y);
			std::cout << ' ' << ' ';

			SetPos(_x, _y + _high - 1);
			std::cout << ' ' << ' ';

			SetPos(_x + _wide - 2, _y + _high - 1);
			std::cout << ' ' << ' ';
		}
	};
}

